const { Controller } = require('egg');

class UserController extends Controller {
  async index() {
    const { ctx } = this;

    ctx.validate({
      name: { type: 'string', required: true },
      age: { type: 'int', required: true },
    });
    const res = await ctx.service.user.findAll();
    ctx.helper.success({
      ctx,
      res,
    });
  }
}

module.exports = UserController;
